package alf.mapping.view.activity;

import alf.mapping.view.activity.R;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public abstract class SimpleAbstractActivity extends Activity 
{

	public abstract void onOk(View v);
	
	public void onCancel(View v) {
		setResult(Activity.RESULT_CANCELED);
		finish();
	}
	
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent i;
		switch (item.getItemId()) {
			case R.id.m_ok:
				this.onOk(null);
				break;
			case R.id.help:
				i = new Intent(this, HelpActivity.class);
				i.putExtra(Intent.EXTRA_SUBJECT, this.getClass().getSimpleName());
				startActivity(i);
				break;
			default:
				super.onOptionsItemSelected(item);
		}
		return true;
	}

	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.simple_menu, menu);
		return true;
	}

}
